#ifndef MANAGEWIDGET_H
#define MANAGEWIDGET_H
#include <QWidget>
#include <QLabel>
#include <QLineEdit>
#include <QPushButton>
#include <QComboBox>
#include <QListWidget>
#include <QSpinBox>
#include <QDomDocument>
#include <QDialog>
#include <QHBoxLayout>
#include <QVBoxLayout>
#include <QGridLayout>
#include "connection.h"
#include <QMessageBox>


class ManageWidget : public QWidget
{
    Q_OBJECT
public:
    explicit ManageWidget(QWidget *parent = 0);
    enum DateTimeType{Time, Date, DateTime};
    QString getDateTime(DateTimeType type);
private:
    QString username;

    QLabel* label;
    QWidget* widget;
    QListWidget* listWidget;

    QLabel* topLabel;
    QLabel* sellFactoryLabel;
    QComboBox* sellFactoryComboBox;
    QLabel* sellBrandLabel;
    QComboBox* sellBrandComboBox;
    QLabel* sellPriceLabel;
    QLineEdit* sellPriceLineEdit;
    QLabel* sellPriceUnitLabel;
    QLabel* sellNumberLabel;
    QSpinBox* sellNumberSpinBox;
    QLabel* sellLastNumberLabel;
    QLabel* sellSumLabel;
    QLineEdit* sellSumLineEdit;
    QLabel* sellSumUnitLabel;
    QPushButton* okButton;
    QPushButton* cancelButton;
    QLabel* bottomLabel;

    QDomDocument doc;
    bool docRead();
    bool docWrite();
    void writeXml();
    void createNodes(QDomElement &date);
    void showDailyList();

private slots:
    void on_sellFactoryComboBox_currentIndexChanged(const QString &arg1);
    void on_sellBrandComboBox_currentIndexChanged(const QString &arg1);
    void on_sellNumberSpinBox_valueChanged(int count);
    void on_cancelButton_clicked();
    void on_okButton_clicked();
};


class VerifyDialog : public QDialog
{
    Q_OBJECT
public:
    explicit VerifyDialog(QWidget *parent = 0);
    QLineEdit* usernameLineEdit;
private:
    QLabel* welcomeLabel;
    QLabel* usernameLabel;
    QLabel* passwordLabel;
    QLineEdit* passwordLineEdit;
    QPushButton* okButton;
    QPushButton* cancelButton;
private slots:
    void slotOkButton();
    void slotcancelButton();
};

#endif // MANAGEWIDGET_H
